lib/repo-pull: Add some missing assertions for progress statistics
authorPhilip Withnall <withnall@endlessm.com>
Wed, 30 May 2018 11:00:22 +0000 (12:00 +0100)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 30 May 2018 16:23:57 +0000 (16:23 +0000)
Various of the counters already have assertions like this; add some more
for total paranoia.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Closes: #1594
Approved by: jlebon

src/libostree/ostree-repo-pull.c

index 668968e67ceae8be1f6cb6fbaa5b84933a3328c8..83ccff5ce7e2c64a034fc7dbc8b1187fa5462674 100644 (file)
@@ -1119,6 +1119,7 @@ content_fetch_on_complete (GObject        *object,
     }
 
  out:
+  g_assert (pull_data->n_outstanding_content_fetches > 0);
   pull_data->n_outstanding_content_fetches--;
 
   if (_ostree_fetcher_should_retry_request (local_error, fetch_data->n_retries_remaining--))
@@ -1168,6 +1169,7 @@ on_metadata_written (GObject           *object,
   queue_scan_one_metadata_object_c (pull_data, csum, objtype, fetch_data->path, 0, fetch_data->requested_ref);
 
  out:
+  g_assert (pull_data->n_outstanding_metadata_write_requests > 0);
   pull_data->n_outstanding_metadata_write_requests--;
   fetch_object_data_free (fetch_data);